<template>
	<view class="">
		<!-- <u-navbar title="线索详情" :bgColor="background" leftIconColor="#ffffff" :titleStyle="{'color':'#ffffff'}" ></u-navbar> -->
		<!-- <hx-navbar title="线索详情" :config="config"  ></hx-navbar> -->
		<view>
			<!-- 正文内容 -->
			<!-- 用户信息 -->
			<view class="userInfo">
				<image class="avator"
					:src="detail.customerType == 2 ? '../../static/clue/avator_company.png' : '../../static/clue/avator_personal.png'"
					mode="aspectFill"></image>
				<view class="userContent">
					<text class="contentText"
						style="font-size: 30rpx;font-weight: bold;">{{detail.customerName|filterNull}}</text>
					<text class="contentText" v-if="2==detail.customerType"
						style="font-size: 24rpx;">{{detail.contact|filterNull}}</text>
					<view style="display: flex;align-items: center;margin: 20rpx 0 0 20rpx;" @click="makecall">
						<text style="font-size: 24rpx;color: #fff;">{{detail.phone|filterNull}}</text>
						<image style="width: 30rpx;height: 30rpx;margin-left: 10rpx;" src="../../static/common/callPhone.png" mode="scaleToFill"></image>
					</view>

				</view>

				<image class="rightContent"
					:src="detail.customerType == 2 ? '../../static/common/company.png' : '../../static/common/personal.png'"
					mode="scaleToFill"></image>
			</view>

			<!-- 基础信息 -->
			<view class="item">

				<view style="display: inline-flex; height: 80rpx; justify-content: space-between; margin: 0 20rpx;">
					<u-icon name="order" color="#1573FF" label="基本信息" label-color="#333333"
						:customStyle="{'line-height': '80rpx',}">
					</u-icon>
				</view>


				<u-line color="#efefef" :customStyle="{'margin-bottom': '30rpx','display': 'block',}"></u-line>

				<view class="text-line">
					<text class="text-name">线索状态:</text>
					<text class="text-value">{{detail.cluesStateStr|filterNull}}</text>
				</view>
				<view class="text-line">
					<text class="text-name">线索描述:</text>
					<text class="text-value">{{detail.cluesDescribe|filterNull}}</text>
				</view>
				<view class="text-line">
					<text class="text-name">创建时间:</text>
					<text class="text-value">{{detail.createTime|filterNull}}</text>
				</view>
				<view class="text-line">
					<text class="text-name">最后跟进时间:</text>
					<text class="text-value">{{detail.updateTime|filterNull}}</text>
				</view>

			</view>

			<!-- 线索信息 -->
			<view class="item">
			
				<view style="display: inline-flex; height: 80rpx; justify-content: space-between; margin: 0 20rpx;">
					<u-icon name="calendar" color="#1573FF" label="线索跟进" label-color="#333333"
						:customStyle="{'line-height': '80rpx',}">
					</u-icon>
				</view>
			
			
				<u-line color="#efefef" :customStyle="{'margin-bottom': '30rpx','display': 'block',}"></u-line>
			
				<view style="margin-left: 20rpx;" v-if="detail.entityList && detail.entityList.length>0">
					<u-steps
						dot current="1" direction="column">
						<u-steps-item :title="item.dealTime" :desc="desc(item)" v-for="(item, index) in detail.entityList" :key="index">
						</u-steps-item>
						
					</u-steps>
				</view>
				
				<no-data v-else content="暂无跟进记录~"></no-data>
			
			</view>
			
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				cluesId: '',
				detail: {}
			}
		},
		onLoad(op) {
			this.cluesId = op.cluesId;

			this.getData();
		},
		methods: {

			getData() {
				this.$u.api.getCluesRecordList({
					cluesId: this.cluesId
				}).then(res => {
					this.detail = res;
					
					this.detail.createTime = uni.$u.timeFormat(this.detail.createTime, 'yyyy-mm-dd hh:MM:ss');
					this.detail.updateTime = uni.$u.timeFormat(this.detail.updateTime, 'yyyy-mm-dd hh:MM:ss');
					
				})
			},
			
			makecall(){
				if(!uni.$u.test.isEmpty(this.detail.phone)){
					uni.makePhoneCall({
						phoneNumber:this.detail.phone
					})
				}
			},
			
			desc(item){
				
				return `跟进人:  ${item.dealProcessor}
						线索状态:  ${1==item.cluesStatus?'初步接触':2==item.cluesStatus?'潜在客户':3==item.cluesStatus?'持续跟进':4==item.cluesStatus?'忠诚客户':5==item.cluesStatus?'无效客户':'--'}
						意向情况:  ${1==item.cluesStatus?'无意向':2==item.cluesStatus?'低意向':3==item.cluesStatus?'中意向':4==item.cluesStatus?'高意向':'--'}
						跟进方式:  ${1==item.cluesStatus?'面谈':2==item.cluesStatus?'电话':3==item.cluesStatus?'微信':4==item.cluesStatus?'短信':5==item.cluesStatus?'邮件':6==item.cluesStatus?'QQ':7==item.cluesStatus?'其它':'--'}
						跟进内容:  ${item.dealResult}
						`;
			}


		}

	}
</script>

<style lang="scss" scoped>
	.userInfo {
		display: flex;
		width: 100%;
		// justify-content: space-between;
		height: 210rpx;
		background-color: #1573FF;

		// background: linear-gradient(45deg, #2464FF, #5765F9);
		.avator {
			margin-top: 30rpx;
			margin-left: 30rpx;
			width: 120rpx;
			height: 120rpx;
		}

		.userContent {
			margin-top: 10rpx;
			display: flex;
			flex: 1;
			flex-direction: column;

			.contentText {
				color: $xz-textColor-FF;
				font-size: $xz-font-size-24;
				position: relative;
				left: 20rpx;
				margin-top: 20rpx;
			}
		}

	}

	.rightContent {
		margin-top: 20rpx;
		margin-right: 0rpx;
		width: 80rpx;
		height: 40rpx;
	}

	.basicaInfo {}
</style>
